<template>
  <div id="app">
    <router-view/>
  </div>
</template>

<script>
  export default {
    name: 'app',
    created() {
      if(window.sessionStorage.getItem('token') === 'ok') {
        this.$store.commit('getLoginState', true)
      }else {
        if(window.sessionStorage.getItem('token') === '') {
          this.$toast('当前登录身份信息已过期，请重新登录', 'center')
          window.sessionStorage.clear()
        }
        this.$router.replace('/index')
        this.$store.commit('getLoginState', false)
      }
    }
  }
</script>
